<%@page import="java.sql.ResultSetMetaData"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%@page import="com.mysql.jdbc.Driver"%>
<%@page import="java.sql.DriverManager"%>
<%@page buffer="8kb" contentType="text/html; charset=UTF-8"
	isErrorPage="true"%>
<!DOCTYPE html >
<html>
	<head>
		<meta charset="UTF-8">
		<title>Insert title here</title>
	</head>
	<body>
		<%
			DriverManager.registerDriver(new Driver());
			Connection con = DriverManager.getConnection("jdbc:mysql://192.168.0.189:3306/91itoffer?charaterEncoding=UTF-8","tance","611722");
			Statement stat = con.createStatement();
			ResultSet rs = stat.executeQuery("SELECT * FROM t_addr_city");
			ResultSetMetaData rsm = rs.getMetaData();
		%>
		<table border = "1">
			<tr>
				<%
					for(int i = 1;i<=rsm.getColumnCount();i++){
				%>
				<th>
				<%=rsm.getColumnName(i) %>
				</th>
				<%		
					}
				%>
			</tr>
			<%
				while(rs.next()){
			%>
				<tr>
					<% 
						for(int i = 1;i<=rsm.getColumnCount();i++){	
					%>
					<td>
						<%=rs.getString(i) %>
					</td>
					<%
						}
					%>
				</tr>
			<%		
				}
			%>
		</table>
		<%
			rs.close();
			stat.close();
			con.close();
		%>
	</body>
</html>
